/**
  ******************************************************************************
  * @file    stm32f4xx_it.c 
  * @author  MCD Application Team
  * @version V1.0.0
  * @date    19-September-2011
  * @brief   Main Interrupt Service Routines.
  *          This file provides template for all exceptions handler and peripherals
  *          interrupt service routine.
  ******************************************************************************
  */ 


/* Includes ------------------------------------------------------------------*/
#include "stm32f4xx_it.h"
#include "myUsart.h"

/*****************************************************************
* 					 GLOBAL VARIABLE
******************************************************************/

uint32_t systick_counter;
//extern void rt_OneStep(void);

/*****************************************************************
* 					 EXTERN FUNCTION
******************************************************************/


/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/


/* Private function prototypes -----------------------------------------------*/
/* Private functions ---------------------------------------------------------*/

/******************************************************************************/
/*            Cortex-M4 Processor Exceptions Handlers                         */
/******************************************************************************/

/**
  * @brief  This function handles NMI exception.
  * @param  None
  * @retval None
  */
void NMI_Handler(void)
{
}

/**
  * @brief  This function handles Hard Fault exception.
  * @param  None
  * @retval None
  */
void HardFault_Handler(void)
{
  /* Go to infinite loop when Hard Fault exception occurs */
  while (1)
  {}
}

/**
  * @brief  This function handles Memory Manage exception.
  * @param  None
  * @retval None
  */
void MemManage_Handler(void)
{
  /* Go to infinite loop when Memory Manage exception occurs */
  while (1)
  {}
}

/**
  * @brief  This function handles Bus Fault exception.
  * @param  None
  * @retval None
  */
void BusFault_Handler(void)
{
  /* Go to infinite loop when Bus Fault exception occurs */
  while (1)
  {}
}

/**
  * @brief  This function handles Usage Fault exception.
  * @param  None
  * @retval None
  */
void UsageFault_Handler(void)
{
  /* Go to infinite loop when Usage Fault exception occurs */
  while (1)
  {}
}

/**
  * @brief  This function handles Debug Monitor exception.
  * @param  None
  * @retval None
  */
void DebugMon_Handler(void)
{}

/**
  * @brief  This function handles SVCall exception.
  * @param  None
  * @retval None
  */
void SVC_Handler(void)
{}

/**
  * @brief  This function handles PendSV_Handler exception.
  * @param  None
  * @retval None
  */
void PendSV_Handler(void)
{}

/**
  * @brief  This function handles SysTick Handler.
  * @param  None
  * @retval None
  */
void SysTick_Handler(void)
{
    static uint32_t ticks;
	// every 1ms
	systick_counter++;
    if (ticks++ >=10)
    {
		// every 10 ms
        //disk_timerproc();
		//rt_OneStep();
        ticks = 0;
    }
}





/******************************************************************************/
/*            STM32F4xx Peripherals Interrupt Handlers                        */
/******************************************************************************/


/***************************************************************************
*						TIMER INTERRUPT
*
****************************************************************************/
void TIM6_DAC_IRQHandler(void)
{
	
}

/***************************************************************************
*						USART1 INTERRUPT
*
****************************************************************************/
void USART1_IRQHandler(void)
{

}



/***************************************************************************
*						DMA USART INTERRUPTs
*
****************************************************************************/
void DMA2_Stream7_IRQHandler(void)
{
	//USART1-TX
	if (DMA_GetFlagStatus(DMA_USART1_TX_STREAM, DMA_FLAG_TCIF7)== SET)
	{
		//must be cleared by software
		DMA_ClearFlag(DMA_USART1_TX_STREAM, DMA_FLAG_TCIF7);
		// transfer complete; do anything here
		GPIO_ToggleBits(GPIOD, GPIO_Pin_12);			
	}            
}

void DMA2_Stream5_IRQHandler(void)
{}

void DMA1_Stream6_IRQHandler(void)
{}

void DMA1_Stream5_IRQHandler(void)
{}

void DMA1_Stream4_IRQHandler(void)
{}

void DMA1_Stream2_IRQHandler(void)
{}

/****************************************************************************
*						DMA SPI INTERRUPTs
*
*****************************************************************************/

void DMA2_Stream3_IRQHandler(void)
{}

void DMA2_Stream2_IRQHandler(void)
{}


/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
